package com.itheima.thread.阻塞队列.demo2;

import java.util.concurrent.ArrayBlockingQueue;

//消费者线程
public class Foodie extends Thread {
    private ArrayBlockingQueue<String> abq;

    public Foodie(ArrayBlockingQueue<String> abq) {
        this.abq = abq;
    }

    @Override
    public void run() {
        //while (true) {
        for (int i = 0; i < 10; i++) {
            try {
                String take = abq.take();
                System.out.println("消费者取出了一个" + take);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
